class Stack(object):
    def __init__(self):
        self.stack = []

    def push(self, x):
        self.stack.append(x)

    def pop(self):
        return self.stack.pop()

    def top(self):
        # （先进后出）栈顶就是最后进的
        return self.stack[-1]

    def isEmpty(self):
        return bool(self.stack)

    def peek(self):
        # （先进后出）栈尾就是最先进的
        return self.stack[0]
        